<include file="Public/head" />
</head>
<include file="Public/common_header" />
<style>
    .chenggong1 .paidan{padding-top:30px;}
    .chenggong1 .paidan h6{color:#666;}
    .chenggong1 .paidan h5{color:red;}
    .chenggong1{width: 750px;}
    .chenggong1 .shenhei-btn{margin: 50px 130px 0px; }
    .chenggong1 .msg{height: 130px;}
</style>
<div class="mian">
<include file="Public/sidebar"  menu="shgl.gh" />
    <div class="mianR">
        <div class="yuyue">
            <ul>
                <li onclick="get_list(1);" class="yuCurrent">待过户</li>
                <li onclick="get_list(2);">过户中</li>                    
                <li onclick="get_list(3);">过户成功</li>
                <li name="transfer_fail" onclick="get_list(4);">过户失败</li>
            </ul>
            <input type="hidden" value="p_order" name="order_type">
        </div>
        <div class="listBox" id="listBox">

        </div>
        <div class="clear"></div>
    </div>
    <div class="yunBei"></div>
    </body>
</html>
<script type="text/javascript">
    get_list(1);
    function get_list(status){
        //var order_type_new = ;
        if("{:I('get.order_type')}" == ""){
            var order_type = $("input[name='order_type']").val();
        }else{
            var order_type = "{:I('get.order_type')}";
        }

      //. alert("{:I('get.order_type')}");

        $.get("/Transfer/getList",{"status":status,"order_type":order_type},function(data){
            $("#listBox").html(data);
            $("input").placeholder();
        },"html");
    }

    function switch_order(obj) {
        if($(obj).val()=="切换到订单管理"){ //到订单管理时，不显示过户失败的信息
            $("input[name='order_type']").val('d_order');
            $("li[name='transfer_fail']").css('display','none');
        }else{ //如果是拍单管理的话，显示过户失败的信息
            $("input[name='order_type']").val('p_order');
            $("li[name='transfer_fail']").css('display','block');
        }
        search();
    }

    function get_page(p){
        var data = $("#searchFrom").serialize() + "&" +encodeURI("p="+p);
        $.get("/Transfer/getList", data, function(data){
            $("#listBox").html(data);
            $("input").placeholder();
            if(status == 4){
                $("input[name='switch_order']").style().display('none');
            }
        },"html");
    }
    
    function search(){
        $.get("/Transfer/getList",$("#searchFrom").serialize(),function(data){
            $("#listBox").html(data);
            $("input").placeholder();
            if(status == 4){
                $("input[name='switch_order']").display('none');
            }
            //init_switch_btn();
        },"html");
    }

    function confirm_vialate(order_id) {
        $(".yunBei").css("display", "block");
        $("#disputeinfo").fadeIn();
        transfer_vialate_do(order_id);
    }

    function transfer_vialate_do(order_id) {
        $('#dispute').click(function () {
            var violate_remark = $("#violate_remark").val();
            if (violate_remark == '') {
                shibai_alert1('请填写争议原因');
                return;
            };
            var post_data = {order_id:order_id,remark:violate_remark};
            $.post('/Transfer/dispute', post_data, function (res) {
                if (res.code == 200) {
                    colse_hide();
                    delay_alert('操作成功!');
                    setTimeout(function () {
                        window.location.reload();
                    }, 500);
                } else {
                    delay_alert(res.msg);
                }
            }, 'json');
            return false;
        });
    }

    // $("div").on('#cancel2','click', function () {
    //     $('.chenggong1').fadeOut();
    //     $('.yunBei').css({'display':'none',"zIndex":999});
    //     $('#disputeinfo').remove();
    // });
    
    function colse_hide(){
    $(".yunBei").css("display","none");
    $("#disputeinfo").fadeOut('slow',function(){
        $("#disputeinfo").remove();
        });
    }       


</script>